package tds.model15.version2;
/**
 * @Company 杭州先锋电子技术股份有限公司
 * @ClassName ConcreteObserver
 * @Description 具体观察者
 * @author tds
 * @Date 2020/1/31 17:11
 * @version 1.0.0
 */
public class ConcreteObserver extends Observer {

    private String name;

    private Subject subject;

    private String observerState;

    public ConcreteObserver(Subject subject, String name){
        this.name = name;
        this.subject = subject;
    }

    @Override
    public void update() {
        observerState = subject.getSubjectState();
        System.out.printf("观察者%s的新状态是%s\n", name, observerState);
    }
}
